/*
 * Chain.java
 *
 * Created on August 22, 2007, 8:10 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package edu.psu.bd.math.grooms;

import org.cgsuite.util.Grid;

/**
 *
 * @author joe
 */

public final class Chain  {
	private final Grid stones;
	private final Grid liberties;
	
	public Chain(
		Grid stones,
		Grid liberties) {
		this.stones = stones.clone();
		this.liberties = liberties.clone();
	}
	
	public Grid getLiberties() {
		return liberties.clone();
	}
	
	public boolean inAtari(org.cgsuite.util.Grid i) {
	
            if (Algorithms.containsAll(i,stones))
                return false;
            return Algorithms.sumGrid (liberties) == 1;
	}

	public Grid getStones() {
		return stones.clone();
	}
	
}


